const express = require('express');
const app = express();
const myParse = require('./myParse');
const qs = require('node:querystring');

// req->中间件->接口
// 棉花采集企业(新疆)->中间商讨差价(西安)协调处理->做衣服企业(浙江)

app.get('/q', (req, res, next) => {
    console.log(req.url)
    req_mid = qs.parse(req.url);
    console.log(req_mid)
    req.body = qs.parse(req_mid);
    console.log(req.body)
    next();
}, (req, res) => {
    console.log(req.body);
    res.send('你好');
})

app.get('/r', myParse, (req, res) => {
    console.log(req.queryObj);
    res.send('你不好');
})

app.listen(3002);